ds_map_destroy


描述

Ds_maps take up space in memory, which is allocated to them when they are created. This means that you also need to free this memory when the ds_map is not needed to prevent errors, memory leaks and loss of performance when running your game. This function does just that.

重要!创建数据结构时,用于标识它的索引值是从0开始的整数值。这意味着不同类型的数据结构可以具有相同索引值,所以如果有疑问你应该使用ds_exists访问它们之前的功能。另请注意, 索引将被重用, 因此, 新创建的数据结构索引值可能会在之后使用, 因此我们建议一直将销毁后持有 ds 索引的变量设置为-1。


语法:

ds_map_destroy(id);

参数 描述
id The id of the map to destroy.


返回:

N/A(无返回值)


例如:

ds_map_destroy(inventory);
inventory = -1;

The above code will destroy the ds_map with the id indexed in the variable "inventory".